

**============================================================================
**date:201908
**study: The Internet, Political Trust, and Regime Types
**database: WVS；the Freedom House Index；World Bank
**goal:data clean & regression 
**============================================================================

clear
clear matrix
set mem 500m

***define the directory***
global WorkingPath "E:\Study\Writing\Internet&Trust\datarunning"
cd $WorkingPath

use InternetUes&PoliticalTrust-2018

******label*****============================================================================
label var v242_age "age"
label var q240_gender "gender"
label var q241_age2 "age square"
label var q24_PersonalTrust "interpersonal trust"
label var q59_FamilyAsset "family asset"
label var q84_PoliticalInterest "political interest"
label var q223_InternetUse "Internet use frequency"
label var q217_Newspaper "newspaper frequency"
label var q218_News_magzines "news_magzines frequency"
label var q219_News_TV "news_TV frequency"
label var q220_News_Broadcast "news_broadcast frequency"
label var q248_education "educational level"
label var q01_politicalTrust_7 "political institution trust"
label var q02_traditional_media "traditional media frequency"
label var q62_materialism "materialism & postmaterialism"
label var q85_petition "individual petition"
label var q86_boycott "individual boycott"
label var q87_demonstration "individual demonstration" 
label var q88_strike "individual strike"
label var TrustArmy "trust in army"
label var TrustPolice "trust in police"
label var TrustCourts "trust in court"
label var TrustGovernment "trust in government"
label var TrustParties "trust in Party"
label var TrustParliament "trust in Parliament"
label var TrustService "trust in public service"
label var q851_petition_countryvalue "country petition index"
label var q861_boycott_countryvalue "country boycott index"
label var q871_demostration_countryvalue "country demonstration index"
label var q881_strike_countryvalue "country strike index"
label var traditionan_participation "average individual expression"
label var g1 "Average Country Expression Index"
label var g2_FHvalue "Freedom house index"
label var g3_Fixed_broadband_Internet "Internet Penetration Rate"
label var g5_GDP "Per Capita GDP"
label var g6_cellphone "Mobile phone Penetration Rate"
label var ln_GDP "Ln_GDP_per_capita"
label var FH_recode "Freedom house index recoded"
label var FH_Category "Freedom house index Category"
label var Internet_FH "interaction_internet_FH"
label var Internet_petition "interaction_internet_petition"
label var Internet_botcott "interaction_Internet_botcott"
label var Internet_demostration "interaction_Internet_demostration"
label var Internet_strike "interaction_Internet_strike"
label var Internet_participation "interaction_Internet_AverageIndex
label var InternetUseDummy "dummy internet use"


******Regression*****============================================================================

***table 2 individual level****

global IndicidualVariable v242_age q240_gender q24_PersonalTrust q59_FamilyAsset q84_PoliticalInterest q223_InternetUse i.q248_education q02_traditional_media traditionan_participation

reg q01_politicalTrust_7 $IndicidualVariable, r
reg q01_politicalTrust_7 $IndicidualVariable i.countrycode, r




***table 3 multilevel****

***null model***
xtmixed  q01_politicalTrust_7|| v2:, variance

global CountryControlVariable ln_GDP g3_Fixed_broadband_Internet  g6_cellphone  FH_recode

***null model***
xtmixed  q01_politicalTrust_7|| v2:, variance

***interaction_model***
xi:xtmixed  q01_politicalTrust_7 $IndicidualVariable $CountryControlVariable c.q223_InternetUse#c.FH_recode|| v2:$CountryControlVariable, variance

***figure 1-margin effect***
margins, dydx(q223_InternetUse) at(FH_recode=(1(1)12))
marginsplot, yline(0, lwidth(thick) lcolor(red) lpattern(dash))


***table 4 multilevel****

***interaction model and margin effect figure******
xi:xtmixed  q01_politicalTrust_7 $IndicidualVariable $CountryControlVariable  c.q223_InternetUse#c.q851_petition_countryvalue q851_petition_countryvalue || v2: $CountryControlVariable  q851_petition_countryvalue, variance

***figure-margin effect***
margins, dydx(q223_InternetUse) at(q851_petition_countryvalue=(1(0.2)2.7))
marginsplot, yline(0, lwidth(thick) lcolor(red) lpattern(dash))


xi:xtmixed  q01_politicalTrust_7 $IndicidualVariable $CountryControlVariable  c.q223_InternetUse#c.q861_boycott_countryvalue q861_boycott_countryvalue ||  v2:$CountryControlVariable q861_boycott_countryvalue, variance
margins, dydx(q223_InternetUse) at(q861_boycott_countryvalue=(1(0.1)2))
marginsplot, yline(0, lwidth(thick) lcolor(red) lpattern(dash))


xi:xtmixed  q01_politicalTrust_7 $IndicidualVariable $CountryControlVariable  i.q248_education  c.q223_InternetUse#c.q871_demostration_countryvalue q871_demostration_countryvalue ||  v2:$CountryControlVariable  q871_demostration_countryvalue, variance
margins, dydx(q223_InternetUse) at(q871_demostration_countryvalue=(1.1(0.1)2))
marginsplot, yline(0, lwidth(thick) lcolor(red) lpattern(dash))


xi:xtmixed  q01_politicalTrust_7 $IndicidualVariable $CountryControlVariable  i.q248_education  c.q223_InternetUse#c.q881_strike_countryvalue $IndicidualVariable $CountryControlVariable || v2:$IndicidualVariable $CountryControlVariable  q881_strike_countryvalue, variance
margins, dydx(q223_InternetUse) at(q881_strike_countryvalue=(1(0.1)2))
marginsplot, yline(0, lwidth(thick) lcolor(red) lpattern(dash))

xi:xtmixed  q01_politicalTrust_7 $IndicidualVariable $CountryControlVariable i.q248_education  c.q223_InternetUse#c.g1 g1 ||  v2:$CountryControlVariable g1, variance

***figure 2-margin effect***
margins, dydx(q223_InternetUse) at(g1=(1(0.1)2))
marginsplot, yline(0, lwidth(thick) lcolor(red) lpattern(dash))



***Appendix****

*description*
tabstat v242_age q240_gender q59_FamilyAsset q84_PoliticalInterest q248_education q62_materialism, by(InternetUseDummy) stat(mean sd range med)

***********
*WTP*
graph hbar WTP_petetion WTP_boycott WTP_demonstration WTP_strike, over(InternetUseDummy) asyvar ylabel(0(0.1)0.6) ytitle("mean of unconventional political participation") yline(0.20 0.34, lwidth(thick) lcolor(red) lpattern(dash))
*HP*
graph hbar HP_petetion HP_boycott HP_demonstration HP_strike, over(InternetUseDummy) asyvar ylabel(0(0.02)0.2) ytitle("mean of unconventional political participation") yline(0.04 0.10, lwidth(thick) lcolor(red) lpattern(dash))

***SUReg****
sureg (TrustArmy TrustPolice TrustCourts TrustGovernment TrustParties TrustParliament TrustService = $IndicidualVariable),corr











   
   
   
   
   
   
   
   